//返回  两棵地区树的toorbar
function  getdistrictToolbar(districtCodeAndName,gridStore,filterLevel,treeId,treeCityId){
    var isCity,districtBar;
    var treeLoader,treeLoaderCity;
    var districtCode;//下级的过滤时使用
    if(districtCodeAndName.substr(5,2)=='00'){
         isCity=true
         districtCode=''
    }
    else  {
        districtCode=districtCodeAndName.substr(0,10) ;
        isCity=false;
    }

  
      treeLoaderCity = new Ext.tree.TreeLoader({
        dataUrl:'../district/buildTreeDistrictJSON.action?level='+filterLevel
    });


      treeLoader = new Ext.tree.TreeLoader({
        dataUrl:'../district/buildTreeDistrictJSON.action?level=6&districtCode='+ districtCode
    });
    //市级树
     var treeCity = new Ext.tree.TreePanel({
		loader : treeLoaderCity,
		border : false,
		rootVisible : false,
		root : new Ext.tree.AsyncTreeNode({
			text : '根目录',
			id : '0'
		})
	});
    //下级树
    var tree = new Ext.tree.TreePanel({
		loader : treeLoader,
		border : false,
		rootVisible : false,
		root : new Ext.tree.AsyncTreeNode({
			text : '根目录',
			id : '0'
		})
	});

treeCity.on('click', function(node, e) {
		//gridStore.removeAll();
		comboxWithTreeCity.setValue(node.id + node.text);
        comboxWithTree.setValue('')
		/*
		 gridStore.proxy = new Ext.data.ScriptTagProxy({
		 url: '../residentArchives/buildJSONString.action?queryZone=' + comboxWithTree.getValue()
		 });
		 gridStore.reload();
		 */
		e.stopEvent();
       // 选到县区一级
         if(node.isLeaf()){
             comboxWithTree.setDisabled(false);
            districtCode=node.id;
            tree.on('beforeload', function(){
            tree.loader.dataUrl = '../district/buildTreeDistrictJSON.action?level=6&districtCode='+districtCode;
        });
        }
      else {
            // districtCode=''
             comboxWithTree.setDisabled(true);
         }


      //tree.root.reload();
	  comboxWithTreeCity.collapse();

	});
tree.on('click', function(node, e) {
		gridStore.removeAll();
		comboxWithTree.setValue(node.id + node.text);
		/*
		 gridStore.proxy = new Ext.data.ScriptTagProxy({
		 url: '../residentArchives/buildJSONString.action?queryZone=' + comboxWithTree.getValue()
		 });
		 gridStore.reload();
		 */
		e.stopEvent();
		comboxWithTree.collapse();
	});


    var comboxWithTreeCity = new Ext.form.ComboBox({
		store : new Ext.data.SimpleStore({
			fields : [],
			data : [[]]
		}),
		editable : false,
		mode : 'local',
		triggerAction : 'all',
		maxHeight : 200,
		width : 220,
        id:treeCityId,
		tpl : " <div style='height:200px'><div id='treeCity'></div></div> ",
		selectedClass : '',
		onSelect : Ext.emptyFn,
		value : districtCodeAndName
	});
    comboxWithTreeCity.on('expand', function() {
		treeCity.render('treeCity');
		treeCity.getRootNode().expand(false, true, function() {
			if (treeCity.getRootNode().firstChild) {
				treeCity.getRootNode().firstChild.expand(false, true);
			}
		});
	});
	var comboxWithTree = new Ext.form.ComboBox({
		store : new Ext.data.SimpleStore({
			fields : [],
			data : [[]]
		}),
		editable : false,
		mode : 'local',
		triggerAction : 'all',
		maxHeight : 200,
		width : 230,
        id:treeId,
		tpl : " <div style='height:200px'><div id='tree'></div></div> ",
		selectedClass : '',
        disabled:isCity,
		onSelect : Ext.emptyFn

	});
    if(!isCity)comboxWithTree.setValue(districtCodeAndName) ;
	comboxWithTree.on('expand', function() {
       
		tree.render('tree');
        tree.getRootNode().reload()
		tree.getRootNode().expand(false, true, function() {
			if (tree.getRootNode().firstChild) {
				tree.getRootNode().firstChild.expand(false, true);
			}
		});
	});


     if(isCity)
      districtBar=new Ext.Toolbar({items :[' ',' ','  ','  ','  ',' ',' ',' ','  ','  ','  ',' ',' ',' ',' ',' ',' ',
                 ' ',' ',' ',' ',' ',' ',' ',' ', ' ',' ',' ',' ',' ',' ',' ',' ', ' ',' ',' ',
                 ' ',' ',' ',' ',' ',' ',' ',' ', ' ',' ',' ',
              ' ','选择省市县区：' ,comboxWithTreeCity,'选择乡镇社区：',comboxWithTree]});
     else
     districtBar=new Ext.Toolbar({items :[' ',' ','  ','  ','  ',' ',' ',' ','  ','  ','  ',' ',' ',' ',' ',' ',' ',
                 ' ',' ',' ',' ',' ',' ',' ',' ', ' ',' ',' ',' ',' ',' ',' ',' ', ' ',' ',' ',
                 ' ',' ',' ',' ',' ',' ',' ',' ', ' ',' ',' ',' ',' ',' ',' ',' ', ' ',' ',' ',
                 ' ',' ',' ',' ',' ',' ',' ',' ', ' ',' ',' ',' ',' ',' ',' ',' ', ' ',' ',' ',
                 ' ',' ',' ',' ',' ',' ',' ',' ', ' ',' ',' ',' ',' ',' ',' ',' ',
            ' ','选','择','地','区',' ', '：' ,comboxWithTree]});
    return districtBar;
}